import fly from '../flyio'
import utils from '../util'
import { uploadPic } from './installer'

// 小程序登录(废弃)
function loadOpenIdByCode(param) {
    return fly.get('/wechat/login', param)
}

// 小程序通过授权获取用户手机号(废弃)
function getPhoneNumber(param) {
    return fly.post('/wechat/getPhoneNumber', param)
}

// 判断用户登录情况
function getLoginTimeStatus(params) {
    return fly.get('/driver/getLoginTimeStatus', params)
}

// 根据手机号获取驾驶员用户信息
function getDriverInfoByPhone(param) {
    return fly.get('/driver/getDriverInfoByPhone', param)
}

// 证件OCR识别
function getImageAutoRecognize(params) {
    return utils.uploadFile('/certificate/imageAutoRecognize', params)
}

// 证件信息保存
function saveFile(params) {
    return fly.post('/certificate/save', params)
}

// 查询证件信息详情
function getCertDetail(params) {
    return fly.get('/driver/getCertDetail', params)
}

// 证件信息更新
function undateCertificate(params) {
    return fly.post('/certificate/update', params)
}

// 司机证件照上传
function setPhotoUpload(params) {
    return utils.uploadFile('/driver/photoUpload', params)
}

// 司机已绑定行驶证列表查询
function getVehicleLicenseQuery(params) {
    return fly.get('/driver/vehicleLicenseQuery', params)
}

// 司机解绑行驶证
function setUnBindVehicleLicense(params) {
    return fly.get('/driver/unBindVehicleLicense', params)
}

// 业户邀请司机页面查询
function queryDriverAgreeDetail(params) {
    return fly.get('/bindApply/queryDriverAgreeDetail', params)
}

// 业户申请，司机处理
function setDriverAgree(params) {
    return fly.get('/bindApply/driverAgree', params)
}

// 司机申请绑定业户
function setDriverApply(params) {
    return fly.post('/bindApply/driverApply', params)
}

// 申请业户绑定查询（待审核和已审核）
function queryApplyResult(params) {
    return fly.get('/bindApply/queryApplyResult', params)
}

// 业户名称模糊查询
function fuzzyQueryHolderName(params) {
    return fly.get('/bindApply/fuzzyQueryHolderName', params)
}

// 司机申请解绑业户
function getDriverUnbindApply(params) {
    return fly.get('/bindApply/driverUnbindApply', params)
}

// 小程序登录获取手机号和token
function loginByCode(params) {
    return fly.get('/code/login', params)
}

// 查询监管平台驾驶证信息
function getDriverLicenceData(params) {
    return fly.get('/appSync/getDriverLicenceData', params)
}

// 查询监管平台从业资格证信息
function getDriverQualificationData(params) {
    return fly.get('/appSync/getDriverQualificationData', params)
}

// 查询监管平台头像信息
function getDriverPhoto(params) {
    return fly.get('/appSync/getDriverPhoto', params)
}

export default {
    uploadPic,
    loadOpenIdByCode,
    getLoginTimeStatus,
    getPhoneNumber,
    getDriverInfoByPhone,
    getImageAutoRecognize,
    saveFile,
    getCertDetail,
    undateCertificate,
    setPhotoUpload,
    getVehicleLicenseQuery,
    setUnBindVehicleLicense,
    queryDriverAgreeDetail,
    setDriverAgree,
    setDriverApply,
    queryApplyResult,
    fuzzyQueryHolderName,
    getDriverUnbindApply,
    // 新接口
    loginByCode,
    getDriverLicenceData,
    getDriverQualificationData,
    getDriverPhoto,
}
